package com.maltys.dp.sequence;

/**
 * @author malty
 */
public class LongestContinuousIncreasingSubsequence {
    public static void main(String[] args) {
        LongestContinuousIncreasingSubsequence subsequence = new LongestContinuousIncreasingSubsequence();
        int lengthOfLCIS = subsequence.findLengthOfLCIS(new int[]{1, 3, 5, 4, 7});
        System.out.println(lengthOfLCIS);
    }

    public int findLengthOfLCIS(int[] nums) {
        int cnt = 1;
        int maxLen = 1;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] > nums[i - 1]) {
                cnt++;
            } else {
                maxLen = Math.max(maxLen, cnt);
                cnt = 1;
            }
        }
        return Math.max(maxLen, cnt);
    }
}
